home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / DHTML - Date and Time / lcd-clock.izs < prev    next >
Text File  |  2005-08-31  |  4KB  |  158 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>LCD Clock
  4. <!/TITLE>
  5.  
  6. <!BROWSER>FF1+ IE5+ Opr7+<!/BROWSER>
  7.  
  8. <!DESCRIPTION>This digital clock script attempts to mimic that cool "glow in the dark" look of a LCD watch when it comes to its interface. Displays the time in standard 12-hour format, with a "AM" and "PM" indicator. Note that in non IE4+/NS6+ browsers, a regular form clock is displayed instead.
  9. <!/DESCRIPTION> 
  10.  
  11. <!CATEGORY>date and time<!/CATEGORY>
  12.  
  13. <!SCRIPT>
  14. <!-- START OF SCRIPT -->
  15. <!-- Step 1: Insert the below style sheet into the HEAD section of your page: -->
  16. <style>
  17. <!--
  18. .styling{
  19. background-color:black;
  20. color:lime;
  21. font: bold 15px MS Sans Serif;
  22. padding: 3px;
  23. }
  24. -->
  25. </style>
  26. <!-- Step 2: Having done this, add the below script where you wish the clock to appear on your page: -->
  27. <span id="digitalclock" class="styling"></span>
  28.  
  29. <script>
  30. <!--
  31.  
  32. /*****************************************
  33. * LCD Clock script- by Javascriptkit.com
  34. * Featured on/available at http://www.dynamicdrive.com/
  35. * This notice must stay intact for use
  36. *****************************************/
  37.  
  38. var alternate=0
  39. var standardbrowser=!document.all&&!document.getElementById
  40.  
  41. if (standardbrowser)
  42. document.write('<form name="tick"><input type="text" name="tock" size="6"></form>')
  43.  
  44. function show(){
  45. if (!standardbrowser)
  46. var clockobj=document.getElementById? document.getElementById("digitalclock") : document.all.digitalclock
  47. var Digital=new Date()
  48. var hours=Digital.getHours()
  49. var minutes=Digital.getMinutes()
  50. var dn="AM"
  51.  
  52. if (hours==12) dn="PM" 
  53. if (hours>12){
  54. dn="PM"
  55. hours=hours-12
  56. }
  57. if (hours==0) hours=12
  58. if (hours.toString().length==1)
  59. hours="0"+hours
  60. if (minutes<=9)
  61. minutes="0"+minutes
  62.  
  63. if (standardbrowser){
  64. if (alternate==0)
  65. document.tick.tock.value=hours+" : "+minutes+" "+dn
  66. else
  67. document.tick.tock.value=hours+"   "+minutes+" "+dn
  68. }
  69. else{
  70. if (alternate==0)
  71. clockobj.innerHTML=hours+"<font color='lime'> : </font>"+minutes+" "+"<sup style='font-size:1px'>"+dn+"</sup>"
  72. else
  73. clockobj.innerHTML=hours+"<font color='black'> : </font>"+minutes+" "+"<sup style='font-size:1px'>"+dn+"</sup>"
  74. }
  75. alternate=(alternate==0)? 1 : 0
  76. setTimeout("show()",1000)
  77. }
  78. window.onload=show
  79.  
  80. //-->
  81. </script>
  82. <!-- END OF SCRIPT -->
  83. <!/SCRIPT>
  84.  
  85. <!PREVIEW>
  86. <!-- START OF SCRIPT -->
  87. <!-- Step 1: Insert the below style sheet into the HEAD section of your page: -->
  88. <style>
  89. <!--
  90. .styling{
  91. background-color:black;
  92. color:lime;
  93. font: bold 15px MS Sans Serif;
  94. padding: 3px;
  95. }
  96. -->
  97. </style>
  98. <!-- Step 2: Having done this, add the below script where you wish the clock to appear on your page: -->
  99. <span id="digitalclock" class="styling"></span>
  100.  
  101. <script>
  102. <!--
  103.  
  104. /*****************************************
  105. * LCD Clock script- by Javascriptkit.com
  106. * Featured on/available at http://www.dynamicdrive.com/
  107. * This notice must stay intact for use
  108. *****************************************/
  109.  
  110. var alternate=0
  111. var standardbrowser=!document.all&&!document.getElementById
  112.  
  113. if (standardbrowser)
  114. document.write('<form name="tick"><input type="text" name="tock" size="6"></form>')
  115.  
  116. function show(){
  117. if (!standardbrowser)
  118. var clockobj=document.getElementById? document.getElementById("digitalclock") : document.all.digitalclock
  119. var Digital=new Date()
  120. var hours=Digital.getHours()
  121. var minutes=Digital.getMinutes()
  122. var dn="AM"
  123.  
  124. if (hours==12) dn="PM" 
  125. if (hours>12){
  126. dn="PM"
  127. hours=hours-12
  128. }
  129. if (hours==0) hours=12
  130. if (hours.toString().length==1)
  131. hours="0"+hours
  132. if (minutes<=9)
  133. minutes="0"+minutes
  134.  
  135. if (standardbrowser){
  136. if (alternate==0)
  137. document.tick.tock.value=hours+" : "+minutes+" "+dn
  138. else
  139. document.tick.tock.value=hours+"   "+minutes+" "+dn
  140. }
  141. else{
  142. if (alternate==0)
  143. clockobj.innerHTML=hours+"<font color='lime'> : </font>"+minutes+" "+"<sup style='font-size:1px'>"+dn+"</sup>"
  144. else
  145. clockobj.innerHTML=hours+"<font color='black'> : </font>"+minutes+" "+"<sup style='font-size:1px'>"+dn+"</sup>"
  146. }
  147. alternate=(alternate==0)? 1 : 0
  148. setTimeout("show()",1000)
  149. }
  150. window.onload=show
  151.  
  152. //-->
  153. </script>
  154.  
  155. <!-- END OF SCRIPT -->
  156. <!/PREVIEW>
  157.  
  158. <!RELATED>NONE<!/RELATED>